package co.kr.hanbitedu.android.sample;

import android.app.Activity;
import android.os.Bundle;
import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ViewFlipper;

public class FlipperDemo2 extends Activity {
    /** Called when the activity is first created. */
	static String[] items={"lorem", "ipsum", "dolor", "sit", "amet",
		"consectetuer", "adipiscing", "elit",
		"morbi", "vel", "ligula", "vitae",
		"arcu", "aliquet", "mollis", "etiam",
		"vel", "erat", "placerat", "ante",
		"porttitor", "sodales", "pellentesque",
		"augue", "purus"};
	ViewFlipper flipper;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        flipper=(ViewFlipper)findViewById(R.id.details);
		
		flipper.setInAnimation(AnimationUtils.loadAnimation(this,
															R.anim.push_left_in));
		flipper.setOutAnimation(AnimationUtils.loadAnimation(this,
															R.anim.push_left_out));

		for (String item : items) {
			Button btn=new Button(this);
			
			btn.setText(item);
			
			flipper.addView(btn,
							new ViewGroup.LayoutParams(
								ViewGroup.LayoutParams.FILL_PARENT,
								ViewGroup.LayoutParams.FILL_PARENT));
		}
		
		flipper.setFlipInterval(2000);
		flipper.startFlipping();
    }
}